class Solution(object):
    def kLengthApart(self, nums, k):
        last = -float('inf')
        for i, num in enumerate(nums):
            if num:
                if i - last <= k:
                    return False
                last = i
        return True